'use strict';

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/*
	1,采用一种比较原始的方法引入其他js库,方法名字是:link
	2,采用函数式编程:promise回调 generator[控制全局]  try catch试调  
	3,说明:线下浏览器允许之间Member试调,线上需要转化成es5 Member.build.js
*/
var Business = function () {
	function Business() {
		_classCallCheck(this, Business);

		console.log('welcome into app of Business ................');
		this.link().then(function () {
			var q = new Public();
		});
	}

	/*path 是要导入的script的路径,这是异步的,引用里面的方法,要注意顺序.先创造script标签,然后加载进去*/
	/*引入的文件也要是换成es5形势才可以*/


	_createClass(Business, [{
		key: 'link',
		value: function link() {
			var path = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '../Public.build.js';

			var promise = new Promise(function (resolve, reject) {
				var script = document.createElement('script');
				script.setAttribute('src', path);
				document.body.appendChild(script);
				//创建了标签,资源还没有加载完
				script.onload = function () {
					resolve(true);
				};
			});
			return promise;
		}
	}]);

	return Business;
}();

var a = new Business();